package connector;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URLDecoder;

/**
 * @author ArkD42
 * @file Jdbc
 * @create 2020 - 05 - 29 - 11:40
 */
public class PropertiesRead {

    static  {

        try {
            // 第一种
            InputStream inputStream01 = PropertiesRead.class.getClassLoader().getResourceAsStream("配置文件.properties");

            // Maven工程的读取路径
            InputStream inputStream02 = new FileInputStream(new File("src/main/resources/配置文件.properties"));

            // 普通工程的读取路径
            InputStream inputStream03 = new FileInputStream(new File("src/配置文件.properties"));


            //第四种
            String file = PropertiesRead.class.getClassLoader().getResource("配置文件.properties").getFile();
            String decode = URLDecoder.decode(file, "utf-8");

            //System.out.println(file);
            //System.out.println(decode);
            InputStream inputStream04 = new FileInputStream(decode);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
